package com.itlong.Mapper;

import com.itlong.Pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

    @Select("select * from user where username=#{username}")
    User getUserByName(String username);

    @Insert("insert into user(username,password,add_time,updata_time)" +
            " values (#{username},#{password},now(),now())")
    int addUser(String username, String password);

    @Update("update user set email=#{email},updata_time=#{updataTime} where id=#{id}")
    void update(User user);

    @Update("update user set user_pic=#{picUrl},updata_time=now() whrer id=#{id}")
    void updatePic(String picUrl,int id);

    @Update("update user set password=#{newPwd},updata_time=now() whrer id=#{id}")
    void updatePwd(String newPwd, int id);
}
